<?
	global $kam_admin, $FullUrl, $arr_table, $table_edit, $config_xml_edit, $element, $column, $name_column_view, $lg;
?>
<?
	
    $cid_url = isset($_GET['cid'])?'&cid='.$_GET['cid']:'';
    $page_url = isset($_GET['page'])?'&page='.$_GET['page']:'';
    $trans_form = ($act=='add_full')?'addsm_full':(($act=='edit_full')?'editsm_full':'');
    $trans_url = 'admin-pro.html?do='.$table_edit.'&act='.$trans_form.$cid_url.$page_url;	

?>
<!-- Alternative Content Box End -->

<div class="contentcontainer med left">
  <div class="headings alt">
  <h2>Chỉnh sửa bài viết</h2>
  </div>
  <div class="contentbox">
    <form action="<?=$trans_url?>" method="post" enctype="multipart/form-data" id="frmEdit" name="frmEdit">
    	<?php
    $cc = new Categories();
    $cid = $element['cid']?$element['cid']:'';
    if(isset($_GET['cid']))
        $cid = $_GET['cid'];
    $tree = $cc->admin_tree_filter('1',$cid,'1', 'article');
    echo $tree;
?>
	<?
    	for($i = 0; $i < count($arr_table);$i++)
        {
            $name_label = $arr_table[$i]['column_name'];
            $type_label = $arr_table[$i]['data_type'];
            $name_column_view = '';
            
            if($config_xml_edit[$i]=='1')
            {
            	$column = $name_label;
                
            	if($type_label == 'text')
                {	
                    if($name_label == 'img')
                    {
                    	$name_column_view = 'Hình Ảnh';
                    	Template::UserControlAD('Image');
						?>
						<div id="dropbox">
                            <span class="message">Kéo thả hình đại diện cần upload vào đây.<br /><i>(Drop images here to upload). </i></span>
                        </div>
						<?
                    }
                    else if(
                    $name_label == 'unique_key_vn' || 
                    $name_label == 'unique_key_en' || 
                    $name_label == 'title_vn'|| 
                    $name_label == 'title_en' || 
                    $name_label == 'keyword_vn' || 
                    $name_label == 'keyword_en' || 
                    $name_label == 'des_vn'|| 
                    $name_label == 'des_en'|| 
                    $name_label == 'seo_f_vn'|| 
                    $name_label == 'seo_f_en')
                    {
                    
                    }
                    else if($name_label == 'name_vn')
                    {
						$name_column_view = 'Tiêu đề';
                    	Template::UserControlAD('TextBox');
                    }
                    else if($name_label == 'price')
                    {
						$name_column_view = 'Giá';
                    	Template::UserControlAD('TextBox');
                    }
                    else if($name_label == 'price_text')
                    {
						$name_column_view = 'Giá';
                    	Template::UserControlAD('TextBox');
                    }
					else if($name_label == 'name_en'|| 
                    $name_label == 'alias_name')
                    {
                    	Template::UserControlAD('TextBox');
                    }
                    else if($name_label == 'short_vn' )
                    {
						$name_column_view = 'Mô tả ngắn';
                    	Template::UserControlAD('TextArea');
                    }
					else if(
                    $name_label == 'short_en')
                    {
                    	Template::UserControlAD('TextArea');
                    }
					else if(
                    $name_label == 'content_vn')
                    {
						$name_column_view = 'Chi tiết bài viết';
                    	Template::UserControlAD('TextBoxCKEditor');
                    }
                    else
                    {
                    	Template::UserControlAD('TextBoxCKEditor');
                    }
                }
                
                if($type_label == 'int')
                {
                	if($name_label == 'num')
                	{
                    	$name_column_view = 'Thứ Tự Hiển Thị';
                		Template::UserControlAD('TextBoxSmall');
                    }
                    else if($name_label == 'active')
                    {
                    	$name_column_view = 'Hiển Thị';
                    	Template::UserControlAD('CheckBox');
                    }                    
                    else
                    {
                    
                    }
                }
            }
        }    
                
    ?>      

      <p><br />
        <br />
        Lưu lại</p>
        
        <?
        	//Template::UserControlAD('SEO-TextBox');
        ?>
      <input type="hidden" name="id" value="<?=isset($_GET['id'])?$_GET['id']:''?>"/>
      <input type="submit" value="submit" class="btn" />
      <input type="submit" value="Submit (Alternative)" class="btnalt" />
      <? 
	  	$_SESSION['articles_id'] = isset($_GET['id'])?$_GET['id']:''; 
		$_SESSION['type_id'] = '1'; 	  
	  ?>
      <p>
      	<br/>
        <br/>
        <br/>
        <label for="textfield"><strong>
        Upload hình ảnh trình chiếu:</strong></label>
        <? Template::UserControlAD('UploadMulti'); ?>
     </p>
    </form>
    
  </div>
</div>
<!--<div class="contentcontainer sml right" id="tabs">
  <div class="headings">
    <h2 class="left">Tabs</h2>
    <ul class="smltabs">
      <li><a href="#tabs-1">Styles</a></li>
      <li><a href="#tabs-2">News</a></li>
    </ul>
  </div>
  <div class="contentbox" id="tabs-1">
    <h2 style="margin-bottom: 15px;">Some styling examples below:</h2>
    <p><strong>List style one</strong></p>
    <ul class="list">
      <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit</li>
      <li>Consectetuer adipiscing elit</li>
      <li>Sed diam nonummy nibh euismod tincidunt</li>
    </ul>
    <div class="spacer"></div>
    <p><strong>List style two</strong></p>
    <ul class="ticklist">
      <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit</li>
      <li class="cross">Consectetuer adipiscing elit</li>
      <li>Sed diam nonummy nibh euismod tincidunt</li>
    </ul>
    <p>Lorem ipsum dolor sit amet, <span class="highlighted">highlighted</span>, sed diam nonummy nibh euismod tincidunt.</p>
    <p>Faded spacer example:</p>
    <div class="spacer"></div>
    <p><span class="dropcap">D</span>rop cap example to make your text stand out more! Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt.</p>
    <div class="spacer"></div>
    <h1> Heading 1 example</h1>
    <div class="spacer"></div>
    <h2>Heading 2 example</h2>
    <div class="spacer"></div>
    <h3>Heading 3 example</h3>
    <div class="spacer"></div>
    <h4>Heading 4 example</h4>
    <div class="spacer"></div>
    <h5>Heading 5 example</h5>
  </div>
  <div class="contentbox nopad" id="tabs-2">
    <div class="newsitem"> <img src="<?=$kam_admin?>/images/news_temp.png" class="hoverimg" alt="News" />
      <h3>Story 1 Example Title</h3>
      <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed...<br />
        <a href="#" title="">Read full story</a></p>
    </div>
    <div class="newsitem"> <img src="<?=$kam_admin?>/images/news_temp.png" class="hoverimg" alt="News" />
      <h3>Story 2 Example Title</h3>
      <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed...<br />
        <a href="#" title="">Read full story</a></p>
    </div>
    <div class="newsitem"> <img src="<?=$kam_admin?>/images/news_temp.png" class="hoverimg" alt="News" />
      <h3>Story 3 Example Title</h3>
      <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed...<br />
        <a href="#" title="">Read full story</a></p>
    </div>
    <div class="newsitem"> <img src="<?=$kam_admin?>/images/news_temp.png" class="hoverimg" alt="News" />
      <h3>Story 4 Example Title</h3>
      <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed...<br />
        <a href="#" title="">Read full story</a></p>
    </div>
    <p class="bottominfo"><a href="#" title="">See all news stories</a></p>
  </div>
</div>-->
<script>
	function TreeFilterChanged(value){
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		  alert ("Browser does not support HTTP Request");
		  return;
		  }
		var url="ajax/checkComp.php";
		url=url+"?id="+value;
		url=url+"&sid="+Math.random();
		url=url+"&comp=1";
		xmlHttp.onreadystatechange=ReadyTreeFilterChanged1 ;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
</script>
